#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	char c[105];
	int n, cnt = 0;
	scanf("%s %d", c, &n);
	int len = strlen(c);
	int i = len - 1;
	while (c[i--] == '*')
	{
		cnt++;
	}
	if (cnt > n) len -= cnt - n;
	for (int j = 0; j < len; j++) printf("%c", c[j]);
	return 0;
}